<?php
/**
 * Deprecated functions that should be avoided in favor of newer functions. Also handles 
 * removed functions to avoid errors. Users should not use these functions in their child 
 * themes.  The functions below will all be removed at some point in a future release.  If your 
 * child theme is using one of these, you should use the listed alternative or remove it from 
 * your child theme if necessary.
 *
 * @package Hybrid
 * @subpackage Legacy
 */

/**
 * Function for handling the old content div. This is for an ongoing transition to move the content 
 * div inside of template files By taking the content div out of header.php, we have greater layout 
 * flexibility. Users should use the .content or .hfeed class to style their content area until version 1.0.
 *
 * @todo Phase out the use of <div id="content">
 *
 * @since 0.5
 * @deprecated 0.5
 * @internal Yes, we're both creating and deprecating this in the same version.
 */
function hybrid_content_wrapper( $div = '' ) {
	if ( 'open' == $div )
		echo '<div id="content"><!-- Deprecated. Use the .content or .hfeed class for styling instead of #content. -->';
	elseif ( 'close' == $div )
		echo '</div><!-- Deprecated. Use the .content or .hfeed class for styling instead of #content. -->';
}

/**
 * Old equivalent of hybrid_entry_class().
 *
 * @since 0.2
 * @deprecated 0.5 Use hybrid_entry_class() instead.
 */
function hybrid_post_class( $deprecated = '' ) {
	hybrid_entry_class( $deprecated );
}

/**
 * Old equivalent of the hybrid_attachment() function.
 *
 * @since 0.2.2
 * @deprecated 0.5 Use hybrid_attachment() instead.
 */
function hybrid_handle_attachment() {
	hybrid_attachment();
}

/**
 * Defines the classes for widgets.
 *
 * @since 0.2.2
 * @deprecated 0.5
 * @return string
 */
function hybrid_widget_class() {
	return 'widget %2$s widget-%2$s';
}

/**
 * Displays the category navigation menu and wraps it in a <div> eement.
 *
 * @deprecated 0.6 Child themes should manually add a category menu using wp_list_categories().
 * @internal This function needs to stay for the long haul (post-1.0).
 *
 * @since 0.1
 */
function hybrid_cat_nav() {
	echo "<div id='cat-navigation'>";

	do_action( 'hybrid_before_cat_nav' );

	echo apply_filters( 'hybrid_cat_nav', hybrid_category_menu( 'menu_class=cat-nav&echo=0' ) );

	do_action( 'hybrid_after_cat_nav' );

	echo '</div>';
}

/**
 * Menu listing for categories. Much like WP's wp_page_menu() functionality. Uses the default 
 * arguments of wp_list_categories().
 *
 * @deprecated 0.6 Child themes should manually add a category menu using wp_list_categories().
 * @internal This function needs to stay for the long haul (post-1.0).
 *
 * @since 0.2.3
 * @uses wp_list_categories() Creates a list of the site's categories
 * @link http://codex.wordpress.org/Template_Tags/wp_list_categories
 * @param array $args
 */
function hybrid_category_menu( $args = array() ) {

	$defaults = array( 'show_home' => false, 'menu_class' => 'cat-nav', 'style' => 'list', 'hide_empty' => 1, 'use_desc_for_title' => 0, 'depth' => 4, 'hierarchical' => true, 'echo' => 1 );
	$args = apply_filters( 'hybrid_category_menu_args', $args );
	$args = wp_parse_args( $args, $defaults );
	extract( $args );

	$args['title_li'] = false;
	$args['echo'] = false;
	$args['style'] = 'list';

	$menu = '<div id="' . $menu_class . '" class="' . $menu_class . '"><ul class="menu sf-menu">';

	if ( $show_home )
		$menu .= '<li><a href="' . get_bloginfo( 'url' ) . '" title="' . $show_home . '" rel="home">' . $show_home . '</a></li>';

	$menu .= str_replace( array( "\t", "\n", "\r" ), '', wp_list_categories( $args ) );

	$menu .= '</ul></div>';

	$menu = apply_filters( 'hybrid_category_menu', $menu );

	if ( $echo )
		echo $menu;
	else
		return $menu;
}

/**
 * Loads the theme search form. This function is maintained for backwards compatibility with 
 * WP and Hybrid. To overwrite, users should create a new 'searchform.php' in their child theme.
 *
 * @deprecated 0.6 Users should add get_search_form() whenever needed.
 * @since 0.1
 */
function hybrid_search_form() {
	$search = apply_filters( 'hybrid_search_form', false );

	if ( empty( $search ) )
		get_search_form();
	else
		echo $search;
}

/**
 * Fires before the ping list if comments/pings are separated.
 * @since 0.6
 * @deprecated 0.7
 */
function hybrid_before_ping_list() {
	do_action( 'hybrid_before_ping_list' );
}

/**
 * Fires after the ping list if comments/pings are separated.
 * @since 0.6
 * @deprecated 0.7
 */
function hybrid_after_ping_list() {
	do_action( 'hybrid_after_ping_list' );
}

/**
 * Displays individual pings. Uses the callback parameter for wp_list_comments().
 *
 * @since 0.6
 * @deprecated 0.7
 * @param $comment The comment variable.
 * @param $args Array of arguments passed from wp_list_comments().
 * @param $depth What level the particular comment is.
 */
function hybrid_pings_callback( $comment, $args, $depth ) {
	$GLOBALS['comment'] = $comment;
	$GLOBALS['comment_depth'] = $depth;

	hybrid_comments_callback( $comment, $args, $depth );
}

/**
 * Ends the display of individual pings. Uses the callback parameter for wp_list_comments().
 *
 * @since 0.6
 * @deprecated 0.7
 */
function hybrid_pings_end_callback() {
	hybrid_comments_end_callback();
}

/**
 * After single posts but before the comments template.
 * @since 0.2
 * @deprecated 0.7 Use hybrid_after_singular().
 */
function hybrid_after_single() {
	hybrid_after_singular();
}

/**
 * After page content but before the comments template.
 * @since 0.2
 * @deprecated 0.7 Use hybrid_after_singular().
 */
function hybrid_after_page() {
	hybrid_after_singular();
}

/**
 * Loads the Utility: After Single widget area. Users can overwrite 
 * 'utility-after-single.php' in child themes.
 *
 * @since 0.4
 * @deprecated 0.7 Use hybrid_get_utility_after_singular().
 */
function hybrid_get_utility_after_single() {
	hybrid_get_utility_after_singular();
}

/**
 * Loads the Utility: After Page widget area. Users can overwrite 
 * 'utility-after-page.php' in child themes.
 *
 * @since 0.4
 * @deprecated 0.7 Use hybrid_get_utility_after_singular().
 */
function hybrid_get_utility_after_page() {
	hybrid_get_utility_after_singular();
}

/* === Removed Functions === */

/* Functions removed in the 0.2 branch. */

function hybrid_get_insert() {
	hybrid_function_removed( 'hybrid_get_insert' );
}

/* Functions removed in the 0.3 branch. */

function load_the_video() {
	hybrid_function_removed( 'load_the_video' );
}

/* Functions removed in the 0.4 branch. */

function hybrid_theme_meta() {
	hybrid_function_removed( 'hybrid_theme_meta' );
}

function hybrid_meta_other() {
	hybrid_function_removed( 'hybrid_meta_other' );
}

function hybrid_load_SimplePie() {
	hybrid_function_removed( 'hybrid_load_SimplePie' );
}

function hybrid_lifestream() {
	hybrid_function_removed( 'hybrid_lifestream' );
}

function hybrid_admin_enqueue_style() {
	hybrid_function_removed( 'hybrid_admin_enqueue_style' );
}

function hybrid_page_id() {
	hybrid_function_removed( 'hybrid_page_id' );
}

function hybrid_page_class() {
	hybrid_function_removed( 'hybrid_page_class' );
}

/* Functions removed in the 0.5 branch. */

function hybrid_all_tags() {
	hybrid_function_removed( 'hybrid_all_tags' );
}

function hybrid_get_users() {
	hybrid_function_removed( 'hybrid_get_users' );
}

function hybrid_footnote() {
	hybrid_function_removed( 'hybrid_footnote' );
}

function hybrid_related_posts() {
	hybrid_function_removed( 'hybrid_related_posts' );
}

function hybrid_insert() {
	hybrid_function_removed( 'hybrid_insert' );
}

/* Functions removed in the 0.6 branch. */

function hybrid_get_authors() {
	hybrid_function_removed( 'hybrid_get_authors' );
}

function hybrid_credit() {
	hybrid_function_removed( 'hybrid_credit' );
}

function hybrid_query_counter() {
	hybrid_function_removed( 'hybrid_query_counter' );
}

function hybrid_copyright() {
	hybrid_function_removed( 'hybrid_copyright' );
}

function hybrid_series() {
	hybrid_function_removed( 'hybrid_series' );
}

/* Functions removed in the 0.7 branch. */

function hybrid_all_cats() {
	hybrid_function_removed( 'hybrid_all_cats' );
}

function hybrid_all_cat_slugs() {
	hybrid_function_removed( 'hybrid_all_cat_slugs' );
}

function hybrid_all_tag_slugs() {
	hybrid_function_removed( 'hybrid_all_tag_slugs' );
}

function hybrid_mime_type_icon() {
	hybrid_function_removed( 'hybrid_mime_type_icon' );
}

function hybrid_attachment_icon() {
	hybrid_function_removed( 'hybrid_attachment_icon' );
}

function hybrid_widow() {
	hybrid_function_removed( 'hybrid_widow' );
}

function hybrid_dash() {
	hybrid_function_removed( 'hybrid_dash' );
}

function hybrid_text_filter() {
	hybrid_function_removed( 'hybrid_text_filter' );
}

function hybrid_allowed_tags() {
	hybrid_function_removed( 'hybrid_allowed_tags' );
}

function hybrid_typography() {
	hybrid_function_removed( 'hybrid_typography' );
}

function hybrid_before_cat_nav() {
	hybrid_function_removed( 'hybrid_before_cat_nav' );
}

function hybrid_after_cat_nav() {
	hybrid_function_removed( 'hybrid_after_cat_nav' );
}

function hybrid_first_paragraph() {
	hybrid_function_removed( 'hybrid_first_paragraph' );
}

function hybrid_category_term_link() {
	hybrid_function_removed( 'hybrid_category_term_link' );
}

function hybrid_post_tag_term_link() {
	hybrid_function_removed( 'hybrid_post_tag_term_link' );
}

function hybrid_search_highlight() {
	hybrid_function_removed( 'hybrid_search_highlight' );
}

function hybrid_primary_inserts() {
	hybrid_function_removed( 'hybrid_primary_inserts' );
}

function hybrid_secondary_inserts() {
	hybrid_function_removed( 'hybrid_secondary_inserts' );
}

function hybrid_subsidiary_inserts() {
	hybrid_function_removed( 'hybrid_subsidiary_inserts' );
}

function hybrid_utility_inserts() {
	hybrid_function_removed( 'hybrid_utility_inserts' );
}

function hybrid_widget_init() {
	hybrid_function_removed( 'hybrid_widget_init' );
}

function hybrid_primary_var() {
	hybrid_function_removed( 'hybrid_primary_var' );
}

function hybrid_secondary_var() {
	hybrid_function_removed( 'hybrid_secondary_var' );
}

function hybrid_subsidiary_var() {
	hybrid_function_removed( 'hybrid_subsidiary_var' );
}

function hybrid_legacy_comments() {
	hybrid_function_removed( 'hybrid_legacy_comments' );
}

function hybrid_head_feeds() {
	hybrid_function_removed( 'hybrid_head_feeds' );
}

function hybrid_legacy_functions() {
	hybrid_function_removed( 'hybrid_legacy_functions' );
}

function hybrid_capability_check() {
	hybrid_function_removed( 'hybrid_capability_check' );
}

function hybrid_template_in_use() {
	hybrid_function_removed( 'hybrid_template_in_use' );
}

function hybrid_get_utility_404() {
	hybrid_function_removed( 'hybrid_get_utility_404' );
}

function hybrid_before_comments() {
	hybrid_function_removed( 'hybrid_before_comments' );
}

function hybrid_meta_abstract() {
	hybrid_function_removed( 'hybrid_meta_abstract' );
}

function hybrid_child_settings() {
	hybrid_function_removed( 'hybrid_child_settings' );
}

function hybrid_post_meta_boxes() {
	hybrid_function_removed( 'hybrid_post_meta_boxes' );
}

function hybrid_page_meta_boxes() {
	hybrid_function_removed( 'hybrid_page_meta_boxes' );
}

function post_meta_boxes() {
	hybrid_function_removed( 'post_meta_boxes' );
}

function page_meta_boxes() {
	hybrid_function_removed( 'page_meta_boxes' );
}

function hybrid_create_meta_box() {
	hybrid_function_removed( 'hybrid_create_meta_box' );
}

function hybrid_save_meta_data() {
	hybrid_function_removed( 'hybrid_save_meta_data' );
}

function get_meta_text_input() {
	hybrid_function_removed( 'get_meta_text_input' );
}

function get_meta_select() {
	hybrid_function_removed( 'get_meta_select' );
}

function get_meta_textarea() {
	hybrid_function_removed( 'get_meta_textarea' );
}

function hybrid_error() {
	hybrid_function_removed( 'hybrid_error' );
}

function hybrid_head_canonical() {
	hybrid_function_removed( 'hybrid_head_canonical' );
}

function hybrid_disable_pagenavi_style() {
	hybrid_function_removed( 'hybrid_disable_pagenavi_style' );
}

function hybrid_comments_feed() {
	hybrid_function_removed( 'hybrid_comments_feed' );
}

function hybrid_before_page_nav() {
	hybrid_function_removed( 'hybrid_before_page_nav' );
}

function hybrid_after_page_nav() {
	hybrid_function_removed( 'hybrid_after_page_nav' );
}

function hybrid_comment_published_link_shortcode() {
	hybrid_function_removed( 'hybrid_comment_published_link_shortcode' );
}

/**
 * Message to display for removed functions.
 * @since 0.5
 */
function hybrid_function_removed( $func = '' ) {
	die( '<code>' . $func . '</code> &mdash; ' . __('This function has been removed or replaced by another function.','hybrid') );
}

?>